//
//  InfoViewController.m
//  WGFGlobalHouse
//
//  Created by waiguofang on 15/4/15.
//  Copyright (c) 2015年 waiguofang. All rights reserved.
//   信息管理

#import "InfoViewController.h"
#import "HeadImgViewController.h"
#import "EmailViewController.h"
#import "CompanyViewController.h"
#import "TelephoneViewController.h"
#import "AddressViewController.h"
#import "TraderInfoNameModal.h"
#import "HeadImgCell.h"
#import "InfoCell.h"

@interface InfoViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
//存放，“手机号码：，”电子邮箱“，”公司简介“等信息
@property (strong, nonatomic) NSMutableArray *infoArrM;
//存放，点击cell跳转的viewcontroller
@property (strong, nonatomic) NSMutableArray *classArrM;

@property (strong, nonatomic) TraderInfoNameModal *traderInfoNameModal;
@property (strong, nonatomic) NSMutableDictionary *traderInfoNameDicM;
@end

@implementation InfoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.titleView setMianTitle:@"信息管理"];
    self.tableView.allowsSelection = NO;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.rowHeight = 44;
    
    // Do any additional setup after loading the view from its nib.
    
}
-(NSMutableArray *)infoArrM
{
    if (_infoArrM == nil)
    {
        _infoArrM = [[NSMutableArray alloc]initWithObjects:@"昵称",@"公司名称",@"身份认证",@"手机号码",@"电子邮箱",@"固定电话",@"所在地区",@"详情地址",@"公司简介", nil];
    }
    return _infoArrM;
}

-(NSMutableArray *) classArrM
{
    if (_classArrM == nil)
    {
        HeadImgViewController *headImgVC = [[HeadImgViewController alloc]initWithNibName:@"HeadImgViewController" bundle:nil];
        EmailViewController *emaiVC = [[EmailViewController alloc]initWithNibName:@"EmailViewController" bundle:nil];
        
        TelephoneViewController *telePhoneVC = [[TelephoneViewController alloc]initWithNibName:@"TelephoneViewController" bundle:nil];
        AddressViewController *addressVC = [[AddressViewController alloc]initWithNibName:@"AddressViewController" bundle:nil];
        CompanyViewController *companyVC = [[CompanyViewController alloc]initWithNibName:@"CompanyViewController" bundle:nil];
        
        _classArrM = [[NSMutableArray alloc]initWithObjects:headImgVC,emaiVC,telePhoneVC,addressVC,companyVC, nil];
        
    }
    return _classArrM;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

{
    return self.infoArrM.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
    
        InfoCell *cell = [InfoCell cellWithTableView:tableView];
        cell.name = [NSString stringWithFormat:@"%@",[self.infoArrM objectAtIndex:indexPath.row ]];
        return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
{
    [tableView  deselectRowAtIndexPath:indexPath animated:YES];
   
    if(indexPath.row == 0)
    {
        [self.navigationController pushViewController:[self.classArrM objectAtIndex:indexPath.row] animated:YES];
    }
    else if (indexPath.row > 3)
    {
        [self.navigationController pushViewController:[self.classArrM objectAtIndex:(indexPath.row - 3)] animated:YES];

    }
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
